Micron Document
Fox's Git Mirrors

Node / rns-mirrors / Reticulum-Go.git / files / pkg / common / interface_mode.go

Displaying Raw • Download

pkg/common/interface_mode.go 633735d797cc5f5d48cb2e22e8fd7cd743930daf (633735d7) Text, 852 B

// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2024-2026 Quad4.io

package common

import "slices"

import "strings"

// ParseInterfaceMode maps config mode strings to wire InterfaceMode values.
func ParseInterfaceMode(s string) InterfaceMode {
switch strings.ToLower(strings.TrimSpace(s)) {
case "", "full":
return IFModeFull
case "pointtopoint", "point_to_point", "ptp":
return IFModePoint
case "access_point", "accesspoint", "ap":
return IFModeAccessPoint
case "roaming":
return IFModeRoaming
case "boundary":
return IFModeBoundary
case "gateway", "gw":
return IFModeGateway
case "internal":
return IFModeInternal
default:
return IFModeFull
}
}

// ModeDiscoversPaths reports whether mode is in DiscoverPathsFor.
func ModeDiscoversPaths(mode InterfaceMode) bool {
return slices.Contains(DiscoverPathsFor, mode)
}

Served by rngit 1.5.2 - Generated in 0.03s